com.doclinx.jftr
Class Log

java.lang.Object
  |
  +--com.doclinx.jftr.Log

public final class Log
extends java.lang.Object

Class for diagnostic logging of TeraXML debug information output. Note that the class is thread safe.


Field Summary
static int CRITICAL
          Only output critical messages.
static java.lang.String LOG
          Default log file name.
 java.lang.String logName
           
static int NONE
          NO debug output.
static int STANDARD
          Only output critical+standard messages.
static int VERBOSE
          Output All messages.
 
Constructor Summary
Log()
          Default Constructor producing NO log file information.
Log(com.doclinx.jftr.Log l)
          Constructor that opens a log file copy.
Log(java.io.PrintWriter pw, java.lang.String logName, int severity)
          Constructor that opens a log file copy from a PrintWriter.
Log(java.lang.String fileName)
          Constructor that opens a log file and sets STANDARD severity.
Log(java.lang.String fileName, int level)
          Constructor that openes a log file and sets severity level.
 
Method Summary
 void close(boolean delete)
          Close log file and optionally delete.
 void exception(java.lang.String sMsg, java.lang.Throwable t)
           
 void finalize()
           
 void flush()
          Flush the log file buffers to disk.
 int getLevel()
          Return current debug level.
 boolean isOpened()
          Checks to see if log file is opened.
 void print(java.lang.String sMsg)
          Output diagnostic information regardless of priority settings.
 void print(java.lang.String sMsg, int level)
          Output diagnostic information message at specified priority.
 void printDate(java.lang.String sMsg, int level)
          Output diagnostic information message at specified priority.
 void reopen()
          Re-opens a closed log.
 int setLevel(int newLevel)
          Set current debug level.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final java.lang.String LOG
Default log file name.

See Also:
Constant Field Values

NONE

public static final int NONE
NO debug output.

See Also:
Constant Field Values

CRITICAL

public static final int CRITICAL
Only output critical messages.

See Also:
Constant Field Values

STANDARD

public static final int STANDARD
Only output critical+standard messages.

See Also:
Constant Field Values

VERBOSE

public static final int VERBOSE
Output All messages.

See Also:
Constant Field Values

logName

public java.lang.String logName
Constructor Detail

Log

public Log(java.lang.String fileName,
           int level)
Constructor that openes a log file and sets severity level.

Parameters:
fileName - Output log file. If null, use default name.
level - Severity level that controls amount of debug information.

Log

public Log(java.lang.String fileName)
Constructor that opens a log file and sets STANDARD severity.

Parameters:
fileName - Output log file. If null, use default name.

Log

public Log(com.doclinx.jftr.Log l)
Constructor that opens a log file copy. (clone)

Parameters:
l - Output log object to copy.

Log

public Log(java.io.PrintWriter pw,
           java.lang.String logName,
           int severity)
Constructor that opens a log file copy from a PrintWriter.

Parameters:
pw - PrinterWriter object to copy.
logName - Name of log file.

Log

public Log()
Default Constructor producing NO log file information.

Method Detail

close

public void close(boolean delete)
Close log file and optionally delete.

Parameters:
delete - If true, the log file is deleted.

print

public void print(java.lang.String sMsg,
                  int level)
Output diagnostic information message at specified priority.

Parameters:
sMsg - String message to output.
level - Priority level of message.
See Also:
severity codes.

printDate

public void printDate(java.lang.String sMsg,
                      int level)
Output diagnostic information message at specified priority. Also include today's date.

Parameters:
sMsg - String message to output.
level - Priority level of message.
See Also:
severity codes.

print

public void print(java.lang.String sMsg)
Output diagnostic information regardless of priority settings.

Parameters:
sMsg - String message to output.

exception

public void exception(java.lang.String sMsg,
                      java.lang.Throwable t)

finalize

public void finalize()
Overrides:
finalize in class java.lang.Object

reopen

public void reopen()
Re-opens a closed log.

Returns:
true if opened.

isOpened

public boolean isOpened()
Checks to see if log file is opened.

Returns:
true if opened.

flush

public void flush()
Flush the log file buffers to disk.


setLevel

public int setLevel(int newLevel)
Set current debug level.

Returns:
previous level.

getLevel

public int getLevel()
Return current debug level.

Returns:
current level.